//
//  PersonalViewController.m
//  ShiWuPai
//
//  Created by app on 16/11/22.
//  Copyright © 2016年 QQ:244987427. All rights reserved.
//

#import "PersonalViewController.h"
#import "SetupViewController.h"
#import "ThirdPartViewController.h"

@interface PersonalViewController ()<UITableViewDelegate>
#define ALERT(msg) [[[UIAlertView alloc] initWithTitle:@"提示" message:msg delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil] show]

@property (strong, nonatomic) IBOutlet UITableView *tabView;
@property (nonatomic, strong) UIBarButtonItem *rightItem;


@end

@implementation PersonalViewController

- (void)viewDidLoad{
    [super viewDidLoad];
    UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 30, 15)];
    titleLabel.textColor = [UIColor whiteColor];
    titleLabel.text = @"我的";
    self.navigationItem.titleView = titleLabel;
    
    self.navigationItem.rightBarButtonItem = self.rightItem;
    self.navigationController.navigationBar.clipsToBounds = YES;
    
    self.tableView.scrollEnabled =NO;
}

- (void)viewWillDisappear:(BOOL)animated{
    [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@""] forBarMetrics:UIBarMetricsDefault];
    [super viewWillDisappear:animated];
}

- (void)viewWillAppear:(BOOL)animated{
    [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"img_my_navbar_375x65_@2x.png"] forBarMetrics:UIBarMetricsDefault];
    self.tabBarController.tabBar.hidden = NO;
    [super viewWillAppear:animated];
    
}

- (UIBarButtonItem *)rightItem {
    if (!_rightItem) {
        _rightItem = [[UIBarButtonItem alloc]initWithImage:[[UIImage imageNamed:@"ic_setting_44x44_@2x.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] style:UIBarButtonItemStylePlain target:self action:@selector(goSetUp)];
        
    }
    return _rightItem;
}

- (void)goSetUp{
    UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Storyboard" bundle:nil];
    SetupViewController *SetupViewCtr = [sb instantiateViewControllerWithIdentifier:@"Setup"];
    [self.navigationController pushViewController:SetupViewCtr animated:YES];
}


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    
    
    
}


- (IBAction)LogIn:(UIButton *)sender {
    UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Storyboard" bundle:nil];
    ThirdPartViewController *thirdPartCtr = [sb instantiateViewControllerWithIdentifier:@"thirdparty"];
    [self.navigationController pushViewController:thirdPartCtr animated:YES];
    
}
@end
